package spring.web.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import spring.web.dto.Category1Dto;
import spring.web.dto.RestfulDto;

import com.ibatis.sqlmap.client.SqlMapClient;

public class RestfulDaoImpl extends SqlMapClientDaoSupport implements RestfulDao {

	SqlMapClient sqlMapClient;
	
	@Override
	public List<Category1Dto> getCategory1List() {
		List<Category1Dto> result = new ArrayList<Category1Dto>();
		
		result = getSqlMapClientTemplate().queryForList("RestfulData.selectCategory1List");
		
		return result;
	}
	
	@Override
	public RestfulDto getData(int dep1_seq , int dep2_seq , int dep3_seq , int id) {
		
		HashMap<String , Integer> map = new HashMap<String, Integer>();
		
		map.put("dep1_seq" ,dep1_seq);
		map.put("dep2_seq" , dep2_seq);
		map.put("dep3_seq" ,dep3_seq);
		map.put("id" , id);
		
		return (RestfulDto)getSqlMapClientTemplate().queryForObject("RestfulData.selectRestfulData" , map);
	}
		
}
